package org.oaix.test;

import com.alibaba.fastjson2.JSON;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.oaix.json.ApiModelProperty;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 活动
 * </p>
 *
 * @author auto
 * @since 2025-06-11
 */
@Getter
@Setter
public class ActivityVO {

    @ApiModelProperty("活动id")
    private Long id;

    @ApiModelProperty("创建组织ID")
    private Long organizationId;

    @ApiModelProperty("活动名称")
    private String activityName;

    @ApiModelProperty("活动开始时间")
    private LocalDateTime startTime;

    @ApiModelProperty("活动结束时间")
    private LocalDateTime endTime;

    @ApiModelProperty("活动方式：线上1、线下2")
    private Integer activityWay;

    @ApiModelProperty("联系人")
    private String contactPerson;

    @ApiModelProperty("联系电话")
    private String contactTel;

    @ApiModelProperty("封面图片")
    private String coverImgUrl;

    @ApiModelProperty("发布时间")
    private LocalDateTime publishTime;

    @ApiModelProperty("发布状态：0未发布、1已发布、2已下架")
    private Integer publishStatus;

    @ApiModelProperty("发布人用户ID")
    private Long publishUser;

    @ApiModelProperty("推荐状态：0未推荐、1已推荐")
    private Integer recommendStatus;

    @ApiModelProperty("活动状态：0未开始、1已开始、2已终止、3已结束")
    private Integer activityStatus;

    @ApiModelProperty("活动操作人用户ID，推荐、终止、下架")
    private Long activityOpUser;

    @ApiModelProperty("活动模块-报名-启用状态: 0关闭、1启用")
    private Integer registerEnable;

    @ApiModelProperty("报名-开始时间")
    private LocalDateTime registerStartTime;

    @ApiModelProperty("报名-结束时间")
    private LocalDateTime registerEndTime;

    @ApiModelProperty("报名-人数限制，为空不限制")
    private Integer registerPersonMaxNum;

    @ApiModelProperty("报名-审核-启用状态：0关闭、1启用")
    private Integer registerAuditEnable;

    @ApiModelProperty("报名-审核通过后用户二次确认-启用状态：0关闭、1启用")
    private Integer registerAuditedConfirmEnable;

    @ApiModelProperty("报名-拒绝后可重复报名-启用状态：0关闭、1启用")
    private Integer registerRefusedRegisterAgainEnable;

    @ApiModelProperty("活动模块-问卷-启用状态: 0关闭、1启用")
    private Integer questionnaireEnable;

    @ApiModelProperty("问卷-填写-开始时间")
    private LocalDateTime questionnaireStartTime;

    @ApiModelProperty("问卷-填写-结束时间")
    private LocalDateTime questionnaireEndTime;

    @ApiModelProperty("活动模块-签到-启用状态: 0关闭、1启用")
    private Integer signEnable;

    @ApiModelProperty("签到-开始时间")
    private LocalDateTime signStartTime;

    @ApiModelProperty("签到-结束时间")
    private LocalDateTime signEndTime;

    @ApiModelProperty("活动模块-评价-启用状态: 0关闭、1启用")
    private Integer evaluateEnable;

    @ApiModelProperty("可评价-开始时间")
    private LocalDateTime evaluateStartTime;

    @ApiModelProperty("可评价-结束时间")
    private LocalDateTime evaluateEndTime;

    @ApiModelProperty("评价页文案")
    private String evaluatePageTitle;

    @ApiModelProperty("评价等级文案设置，格式：[{\"type\":\"star\",\"level\":1,\"desc\":\"描述\"}]")
    private String evaluateLevelConfig;

    @ApiModelProperty("活动详情（富文本）")
    private String activityDetail;

    public String getEvaluateLevelConfig() {
        if (StringUtils.isBlank(evaluateLevelConfig)){
            List<EvaluateLevelSet> sets = new ArrayList<>();
            sets.add(new EvaluateLevelSet(1));
            sets.add(new EvaluateLevelSet(2));
            sets.add(new EvaluateLevelSet(3));
            sets.add(new EvaluateLevelSet(4));
            sets.add(new EvaluateLevelSet(5));
            evaluateLevelConfig = JSON.toJSONString(sets);
        }
        return evaluateLevelConfig;
    }

    @Setter
    @Getter
    private static class EvaluateLevelSet{
        public EvaluateLevelSet() {
        }
        public EvaluateLevelSet(Integer level) {
            this.level = level;
        }
        private String type = "star";
        private Integer level;
        private String desc = "";

    }


}
